import request from '@/axios'

export const getMenuListApi = (params?: any) => {
  return request.get({ url: '/admin/menu', params })
}
//更新状态
export const changeStatusApi = (data) => {
  return request.put({ url: '/admin/menu/status', data })
}
//菜单回显
export const getMenuShowApi = (params) => {
  return request.get({ url: '/admin/menu/detail', params })
}
//删除菜单
export const delMenuApi = (data): Promise<IResponse> => {
  return request.delete({ url: `/admin/menu`, data })
}
//新增菜单
export const createMenuApi = (data): Promise<IResponse> => {
  return request.post({ url: `/admin/menu`, data })
}
//更新菜单
export const editMenuApi = (data): Promise<IResponse> => {
  return request.put({ url: `/admin/menu`, data })
}
//新增菜单内权限选项
export const createMenuItemApi = (data): Promise<IResponse> => {
  return request.post({ url: `/admin/menu/role`, data })
}
//更新菜单内权限选项
export const editMenuItemApi = (data): Promise<IResponse> => {
  return request.put({ url: `/admin/menu/role`, data })
}
//删除菜单内权限选项
export const delMenuItemApi = (params): Promise<IResponse> => {
  return request.delete({ url: `/admin/menu`, params })
}
